import time

import pymysql
import base64

# conn = pymysql.connect(host="127.0.0.1", port=3306, user="root", password="mysql", database="workflow", charset="utf8")


#建立游标
# cursor = conn.cursor()

# with open('../static/upload/钉钉登录流程.png', 'rb') as f:
#
#     encodestr = base64.b64encode(f.read())
#
#     # 入库
# sql = "insert into user (base64photo) values ('%s')" % encodestr.decode()
#
# cursor.execute(sql)
# conn.commit()
# cursor.close()
# conn.close()


# 读取
# sql = "select base64photo from user where id=38"
# cursor.execute(sql)
#
# res = cursor.fetchone()
#
# print(res[0])
# cursor.close()
# conn.close()
import redis
# redis = redis.Redis(host='127.0.0.1')
redis1 = redis.Redis(host='127.0.0.1',port=6379,db=1,decode_responses=True)
# 发布者订阅者
redis1.publish("workflow", "hello")





# redis1.zincrby("leave", 13, "uid14")
# print(redis1.zrange("leave",0,9, withscores=True,desc=False))

# a = {"msg": 123,"img":456,"msg":"321","img":"456"}

# redis.lpush("41:43",'45-img-福萨.jpg','123')
# # redis.expire("41:43", 10)
# print(redis.lrange("41:43",0,-1))
#
# print(redis1)
# redis1.lpushx('40:90', {"name": "!23","type": "23sa"})
# print(redis1.lrange('40:90',0,-1))

# for i in range(10,-1,-1):
#     print(i)
# res = redis.get('122211')
# print(res)
# # 1605062870.9107397
# for key,value in res.items():
#     a = {}
#     req_dict = {}
#     req_dict["task_id"] = key.decode()
#     req_dict["message"] = value.decode()
#     b.append(req_dict)
# print(b)


# data = {"name": "123", "age":18}
# a = data.keys()
# print(list(a))





